<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>


<body>
  <div id="test"></div>
</body>



<script type="text/javascript" src="../js/react.development.js"></script>
<script type="text/javascript" src="../js/react-dom.development.js"></script>
<script type="text/javascript" src="../js/babel.min.js"></script>


<script type="text/babel"> //必须声明 babel
  class Mycompotents extends React.Component {
    constructor(props) {
      super(props)
      this.state = {
        isHot: true
      }
    }

    render () {
      const { isHot } = this.state
      return <h1 onClick={demo}>今天天气很{isHot ? '炎热' : '凉爽'}</h1>
    }
  }
  // 渲染虚拟 DOM 到页面真实 DOM 容器中
  ReactDOM.render(<Mycompotents />, document.getElementById('test'))
  function demo () {
    console.log('被点击了');

  }
</script>

</html>